#include <iostream>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <cstdio>
using namespace std;
#define for(i, n) for(int i=1; i<=n; i++)
#define MAXN 5123
//#define LOCAL


long long x[MAXN], y[MAXN];
long long d[MAXN];
bool v[MAXN];

inline long long cal(int p1, int p2){
    return (x[p1]-x[p2])*(x[p1]-x[p2]) + (y[p1]-y[p2])*(y[p1]-y[p2]);
}
int main(){
    ios::sync_with_stdio(false);
#ifdef LOCAL
    freopen("testdata.in", "r", stdin);
#endif
    fill(d, d+MAXN+1, LLONG_MAX);
    int N;
    cin >> N;
    for(i, N){
        cin >> x[i] >>y[i];
    }
    d[1] = 0;
    for(i, N-1){
        int p = 0;
        for(j, N){
            if(!v[j]){
                if(p==0||d[j]<d[p]) p = j;
            }
        }
        v[p] = true;
        for(k, N){
            if(!v[k]){
                d[k] = (cal(p, k) < d[k]) ? cal(p, k): d[k];
            }
        }
    }
    double ans = 0;
    for(i, N){
        ans += sqrt(d[i]);
    }
    cout << fixed <<setprecision(2) << ans;
    return 0;
}

/*******************Dijkstra算法 拿了10分
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
#define MAXN 5005
struct edge{
    int a, b;
    double w;
    bool operator < (const edge &tmp)const{
        return w < tmp.w;
    }
}e[MAXN*MAXN];

int fa[MAXN], x[MAXN], y[MAXN];
int find(int a){
    return fa[a] == a ? a : fa[a] = find(fa[a]);
}
int main() {
    int N;
    cin >> N;

    for(int i=1; i<=N; ++i){
        cin >> x[i] >> y[i];
        fa[i] = i;
    }
    int M = 0;
    for(int i=1; i<=N; ++i){
        for(int j=i+1; j<=N; ++j){
            M++;
            e[M].a = i; e[M].b = j;
            int x0 = x[i]-x[j], y0 = y[i]-y[j];
            e[M].w = sqrt(x0*x0 + y0*y0);
        }
    }

    sort(e+1, e+1+M);

    double ans = 0;
    for(int i=1; i<=M; ++i){
        if(find(e[i].a) != find(e[i].b)){
            fa[find(e[i].a)] = find(e[i].b);
            ans += e[i].w;
        }
    }

    printf("%.2f", ans);
    return 0;
}
********************************/